package com.buddy.design.pattern._06template.cource;

public abstract class NetWorkCourse {

    public final void createCource(){
        //1.发布预习资料
        this.postPreResource();
        //2.制作PPT
        this.createPPT();
        //3.在线直播
        this.liveVideo();
        //4.提交课件、笔记
        this.postNode();
        //5.提交源码
        this.postSource();
        //6.布置作业
        if (needHomework()){
            checkHomework();
        }
    }

    protected abstract void checkHomework();

    //钩子方法：留给用户微调的方法
    protected  boolean needHomework(){
        return false;
    }

    final void postSource(){
        System.out.println("5.提交源代码");
    }

    final void postNode(){
        System.out.println("4.提交课件、笔记");
    }

    final void liveVideo(){
        System.out.println("3.在线直播授课");
    }

    final void createPPT(){
        System.out.println("2.创建备课的PPT");
    }

    final void postPreResource(){
        System.out.println("1.分发预习资料");
    }

}
